Setting up the RidgeRun Data Plane Kit from source
RidgeRun Data Plane Kit RidgeRun documentation is currently under development. |
Installing Dependencies
The dependencies for DPDK are:
Building System:
- meson
- ninja
System Tools:
- pyelftools
- libnuma
- build-essential
To install them:
# Update repositories sudo apt-get update # Install compilers and interpreters sudo apt-get install python3 python3-pip build-essential # Install building system sudo apt-get install ninja-build pip3 install meson # Install tools pip3 install pyelftools sudo apt-get install libnuma-dev
Compiling DPDK
First, download DPDK from this link. For the case of this page, we are going to select the 23.11.1 LTS (Long Term Support). Alternatively, it is possible to download it using:
wget https://fast.dpdk.org/rel/dpdk-23.11.1.tar.xz
Then, uncompress the file and prepare the environment for compilation:
tar xf dpdk-23.11.1.tar.xz cd dpdk-stable-23.11.1
Proceed with the compilation. By default, it is installed into /usr/local
as prefix:
meson builddir -Dexamples=all ninja -C builddir sudo ninja -C builddir install
NIC Binding
For testing the DPDK installation, first, load the UIO modules:
sudo modprobe uio sudo modprobe uio_pci_generic
The UIO (Userspace IO) modules allow userspace applications to access hardware devices.
Then, it is possible to search if the device can be used for DPDK by listing it:
cd usertools python3 ./dpdk-devbind.py -s
It should give a similar output to the following:
user@user-ridgerun ~/tmp/dpdk-stable-23.11.1/usertools $ python3 dpdk-devbind.py -s Network devices using kernel driver =================================== 0000:02:00.0 'RTL810xE PCI Express Fast Ethernet controller 8136' if=enp2s0 drv=r8169 unused=vfio-pci,uio_pci_generic *Active* 0000:03:00.0 'QCA9377 802.11ac Wireless Network Adapter 0042' if=wlp3s0 drv=ath10k_pci unused=vfio-pci,uio_pci_generic No 'Baseband' devices detected ============================== No 'Crypto' devices detected ============================ No 'DMA' devices detected ========================= No 'Eventdev' devices detected ============================== No 'Mempool' devices detected ============================= No 'Compress' devices detected ============================== No 'Misc (rawdev)' devices detected =================================== No 'Regex' devices detected =========================== No 'ML' devices detected ========================
The output above shows the Ethernet card: 'RTL810xE PCI Express Fast Ethernet controller 8136'
, which is, in this case, a laptop ethernet card.
After listing, it is possible to unbind the kernel from the Ethernet card:
NIC=enp2s0 sudo ifconfig $NIC down
where NIC=enp2s0
is the network interface, obtained by using ip addr
command. The command from above releases the interface.
Then, bind it to DPDK:
PCIE_ID=0000:02:00.0 sudo python3 ./dpdk-devbind.py --bind=uio_pci_generic ${PCIE_ID}
where PCIE_ID=0000:02:00.0
is obtained using the python3 dpdk-devbind.py -s
command (shown above).
To check the binding, re-execute:
cd usertools python3 ./dpdk-devbind.py -s
the output shows the binding:
user@user-ridgerun ~/tmp/dpdk-stable-23.11.1/usertools $ python3 ./dpdk-devbind.py -s Network devices using DPDK-compatible driver ============================================ 0000:02:00.0 'RTL810xE PCI Express Fast Ethernet controller 8136' drv=uio_pci_generic unused=r8169,vfio-pci Network devices using kernel driver =================================== 0000:03:00.0 'QCA9377 802.11ac Wireless Network Adapter 0042' if=wlp3s0 drv=ath10k_pci unused=vfio-pci,uio_pci_generic *Active* ...
Hugepages Allocation
DPDK use huge pages instead of pages, for this reason it is necessary to allocate huge pages for the DPDK application. the library already provides a python script to do this:
cd <DPDK installation path>/usertools/ sudo python ./dpdk-hugepages.py --pagesize 2M --setup 256M --node 0
This commnad allocate huge pages of size 2MB, and a total of 256MB of memory on NUMA (Non Uniform Memory Access) node 0. The same script can be used to check the status of the huge pages allocated:
./dpdk-hugepages.py -s
It will give an output similar to this:
Node Pages Size Total 0 128 2Mb 256Mb Hugepages mounted on /dev/hugepages